import {getStyle} from "@/utils/tool";

export default {
  mounted(el) {
    const oImgWrap = el,
          oMagWrap = document.querySelector('.mag-wrap'),
          magImg = document.querySelector('.mag-img'),
          imgWidth = getStyle(oImgWrap, 'width'),
          imgHeight = getStyle(oImgWrap, 'height'),
          magWidth = getStyle(oMagWrap, 'width'),
          magHeight = getStyle(oMagWrap, 'height'),
          imgX = oImgWrap.offsetLeft,
          imgY = oImgWrap.offsetTop

    const init = () => {
      bindEvent();
    }

    function bindEvent() {
      oImgWrap.addEventListener('mouseover', function (e) {
        oMagWrap.className += ' show';
      }, false)

      oImgWrap.addEventListener('mouseout', handleMouseOut, false)
    }

    function handleMouseOut() {
      oMagWrap.className = 'mag-wrap'
    }

    init()
  }
}